clear all;
load 'data_log.txt'

neuron_id = data_log(:,1);
time = data_log(:,2);
neuron_vm = data_log(:,3);
neuron_gk = data_log(:,4);
neuron_gkir2 = data_log(:,5);
neuron_t_last = data_log(:,6);

num_neurons = max(neuron_id) + 1;

for i=1:1
  nid = find(neuron_id == i-1);
  neuron_i_vm = neuron_vm(nid);
  neuron_i_gk = neuron_gk(nid);
	neuron_i_gkir2 = neuron_gkir2(nid);
  figure; hold on;
  plot(neuron_i_vm,'b');
  plot(neuron_i_gk,'r');
  plot(neuron_i_gkir2,'k');
  title('Kir2-Ca-K-Na Channel Neuron');
  xlabel('Time (simulation time step)');
  ylabel('Membrane Potential: Scaled 0-10');
  legend(strcat('Neuron',int2str(i),' Vm'),'G_k','G_kir2');
  axis tight;
end


% This should be linear to indicate sim is running smoothly.
% figure; hold on;
% plot(neuron_0_t); %Plot of simulation time vs real time.
